import axios from 'axios';
import { Toast } from 'antd-mobile'
const instance = axios.create({
  baseURL: 'https://www.linweiqin.cn/api/public/v1/',
});

// 请求响应
instance.interceptors.request.use(config => {
  // Do something before request is sent
  Toast.loading('正在加载...', 0, null, true);
  return config;
}, error => {
  // Do something with request error
  return Promise.reject(error);
});

// 返回响应
instance.interceptors.response.use(response => {
  // Do something before response is sent
  Toast.hide();
  return response.data;
}, error => {
  // Do something with response error
  return Promise.reject(error);
});

export default instance;